package com.estronger.shopmanage.adapter.batchpg;

import android.text.Editable;
import android.text.TextWatcher;

/**
 * 列表上的输入框
 */
public class ItemTextSwitcher implements TextWatcher {

    private int type;//类型
    private BatchPgConfirmAdapter.ViewHolder myViewHolder;
    private AfterEditedListener listener;

    public ItemTextSwitcher(BatchPgConfirmAdapter.ViewHolder myViewHolder, int type, AfterEditedListener listener) {
        this.myViewHolder = myViewHolder;
        this.type = type;
        this.listener = listener;
    }

    @Override
    public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}

    @Override
    public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

    }

    @Override
    public void afterTextChanged(Editable editable) {
        if (editable != null) {
            listener.onAfterEdited(myViewHolder.positon, editable.toString().trim());
        }
    }
}